package com.zhuangjie.generator.test.task2.service;

import com.alibaba.excel.EasyExcel;
import com.zhuangjie.generator.test.task2.entity.TOrder;
import com.zhuangjie.generator.test.task2.listener.TOrderAnalysisEventListener;

import java.io.File;

public class TOrderService {
    public static void main(String[] args) {
        importToDB();
    }

    public static void importToDB() {
//        List<TOrder> list = new ArrayList<>();
//        list.add(new TOrder("T01", LocalDate.parse("2020-01-01"),10));
//        list.add(new TOrder("T02",LocalDate.parse("2020-03-01"),50));
//        list.add(new TOrder("T03",LocalDate.parse("2020-09-01"),100));
//        list.add(new TOrder("T04",LocalDate.parse("2020-03-03"),55));
//        list.add(new TOrder("T05",LocalDate.parse("2020-09-03"),55));
        File file = new File("D://导出列表.xlsx");
        EasyExcel.read(file, TOrder.class, new TOrderAnalysisEventListener()).sheet().doRead();

//        try {
//            FileOutputStream fileOutputStream = new FileOutputStream(file);
//            EasyExcel.write(fileOutputStream, TOrder.class)
//                    .autoCloseStream(Boolean.FALSE)
//                    .sheet("导出列表")
//                    .doWrite(list);

//        } catch (Exception e) {
//            e.printStackTrace();
//        }
    }


}
